import Vue from 'vue'
import VueRouter from 'vue-router'
import Default from '../layout/Default.vue'
import Home from '../views/Home.vue'



Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: '/default'
  },
  {
    path: '/default',
    name: 'Default',
    component: Default,
    children: [{
        path: 'home',
        name: 'Home',
        component: Home
      },
      {
        path: 'about',
        name: 'About',
        component: () => import( /* webpackChunkName: "home" */ '../views/About.vue')
      },
      {
        path: 'shengming',
        name: 'Shengming',
        component: () => import( /* webpackChunkName: "home" */ '../views/Shengming.vue')
      }
    ]
  },
  {
    path: '/auth',
    name: 'Auth',
    component: () => import( /* webpackChunkName: "auth" */ '../layout/Auth.vue'),
    children: [{
        path: 'login',
        name: 'Login',
        component: () => import( /* webpackChunkName: "login" */ '../views/Auth/Login.vue'),
      },
      {
        path: 'register',
        name: 'Register',
        component: () => import( /* webpackChunkName: "register" */ '../views/Auth/Register.vue'),
      },
    ]
  }, {
    path: '/admin',
    name: 'Admin',
    component: () => import( /* webpackChunkName: "admin" */ '../layout/Admin.vue'),
    children: [{
        path: 'list',
        name: 'List',
        component: () => import( /* webpackChunkName: "list" */ '../views/Admin/List.vue'),
      },
      {
        path: 'add',
        name: 'Add',
        component: () => import( /* webpackChunkName: "add" */ '../views/Admin/Add.vue'),
      }, {
        path: 'edit/:id',
        name: 'Edit',
        component: () => import( /* webpackChunkName: "edit" */ '../views/Admin/Edit.vue'),
      },
    ]
  },
  {
    path: '*',
    component: () => import( /* webpackChunkName: "404" */ '../views/404.vue'),
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router